<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>商品列表</title>
</head>
<body>
<p>&nbsp;</p>
    <form id="tableForm" name="tableForm" method="post" action="/saveOrder">
        <table width="1050" border="1">
            <tr>
                <td colspan="5">
                    商品名称<input type="text" name="name" th:value="${name}"/>
                    发布时间<input type="date" name="startdate" th:value="${startdate}"/>
                    至
                    <input type="date" name="enddate" th:value="${enddate}">
                    <input type="button" name="Submit" value="查询" onclick="queryGoods()"/>
                </td>
                <td width="32">&nbsp;</td>
            </tr>
            <tr>
                <td width="90">&nbsp;</td>
                <td width="346">商品名称</td>
                <td width="275">商品详情</td>
                <td width="273">商品数量</td>
                <td width="346">发布日期</td>
                <td>价格</td>
            </tr>
            <tr th:each="goods:${pageInfo.list}">
                <td><input type="checkbox" name="id" th:value="${goods.id}"></td>
                <td th:text="${goods.pName}"></td>
                <td th:text="${goods.pContent}"></td>
                <td th:text="${goods.pQuantity}"></td>
                <td>
                    <span th:text="${#dates.format(goods.pCreatedate,'yyyy-MM-dd')}"></span>
                </td>
                <td th:text="${goods.pPrice}"></td>
            </tr>
            <tr>
                <td colspan="6"><div align="right">
                    <a th:href="@{/goods/queryByDynamicFields(pageNum=${pageInfo.prePage})}">上一页</a>
                    <a th:href="@{/goods/queryByDynamicFields(pageNum=${pageInfo.nextPage})}">下一页</a>
                    总计<span th:text="${pageInfo.pages}"></span>页 当前第<span th:text="${pageInfo.pageNum}">页</span>
                </div></td>
            </tr>
            <tr>
                <td colspan="6"><div align="right">
                    <input type="button" name="Submit2" value="保存订单" onclick="saveOrder()">
                </div></td>
            </tr>
        </table>
    </form>
</body>

<script type="text/javascript">
    function queryGoods() {
        document.tableForm.action="/goods/queryByDynamicFields";
        document.tableForm.submit();
    }

    function saveOrder() {
        document.tableForm.action="/goods/saveOrder";
        document.tableForm.submit();
    }
   </script>
</html>